package com.shadow.demo.shiro.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shadow.demo.common.bo.R;
import com.shadow.demo.data.BaseController;
import com.shadow.demo.data.shiro.entity.Permission;
import com.shadow.demo.shiro.service.PermissionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("permission")
public class PermissionController extends BaseController {

    @Resource
    private PermissionService permissionService;

    @PostMapping("/list")
    public R getUserList(@RequestParam Map<String, Object> params) {
        Page<Permission> page = permissionService.getList(params);
        return successPage(page);
    }

    // todo: 分页

    @GetMapping("detail/{id}")
    public R detail(@PathVariable String id) {
        return R.success(permissionService.getById(id));
    }

}
